package com.credithc.customers.dataservice.mapper.HHRJKD;

import com.credithc.baseserv.core.mapper.BsBaseMapper;
import com.credithc.customers.dataservice.po.HHRCJAccountPo;
import com.credithc.customers.dataservice.po.HHRCJUsersPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UsersMapper extends BsBaseMapper<HHRCJUsersPO> {
    @Select("SELECT max(userid) from users;")
    Long queryUsersMaxId();
    @Select("select account_no accountNo ,users.acc_time createTime ,customerNo ,userid  from users" +
            " where userid < #{toString} and userid >= #{toString}-1000 ORDER BY userid;")
    List<HHRCJAccountPo> queryAcount(String toString);
    @Select("SELECT max(cardid) from bank_account;")
    Long queryBankMaxId();
    @Select("select bank_account.card_no accountNo, bank_account.add_time createTime,users.customerNo,users.userid from bank_account LEFT JOIN users on users.userid = bank_account.userid" +
            "  where bank_account.cardid < #{toString}  and bank_account.cardid >= #{toString}-1000 ORDER BY bank_account.cardid ")
    List<HHRCJAccountPo> queryBank(String toString);
}
